<template>
    <div class="bg-white rounded-8px">
      <div class="p-30px text-24px font-600 rounded-8px">{{paper.paper_name}}</div>
    </div>
    <div class="bg-white rounded-8px mt-20px">
        <ExamComponent 
        :topics="topicList"
        :type=paper.type
        :totalScore= 0
        :totalTime= 0
        >
        <!-- 自定义结果展示 -->
        <!-- <template #result="{ results }">
            <div v-for="(result, index) in results" :key="index">
            第{{ index + 1 }}题: {{ result.isCorrect ? '正确' : '错误' }}
            </div>
        </template> -->
        </ExamComponent>
    </div>
    
  </template>
  
  <script setup>
  import ExamComponent from '../../components/ExamComponent.vue'
  import { systemApi,userApi,httpApi } from '../../api/api'
  import { configStore } from '../../stores/config'
  import { diffTwoDates,getToday } from '../../utils/tool'
  import { ElMessage, ElMessageBox,ElLoading  } from 'element-plus'
  import { ref,onMounted,watch, onBeforeMount } from "vue"
  import { useRoute } from 'vue-router'
  const config = configStore()
  const lessonData = ref({})
  const route = useRoute()
  const paper = ref({type:parseInt(route.query.type),section_id:route.query.section_id,})
  const topicList = ref([])
  

  const init = async()=>{
    //console.log("试卷内容：",paper.value)
    lessonData.value = config.getBook()
    let params = {
        section_id:paper.value.section_id,
        type:"wrong"
   
    }
    let res = await httpApi.getSectionTopic(params)
    if(res.code){
        topicList.value = res.data
        console.log("试卷内容：",topicList.value)
    }

  }
  
  const handleSubmit = (results) => {
    console.log('考试结果:', results)
    // 处理提交逻辑...
  }
  onBeforeMount(async() => {
    await init()
  })
  onMounted(async() => {
    
  })

  </script>